//
//  VideoTableViewCell.m
//  news
//
//  Created by dllo on 16/3/10.
//  Copyright © 2016年 imacbookair. All rights reserved.
//

#import "VideoTableViewCell.h"
#import <Masonry.h>
@implementation VideoTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        /** 图片 **/
        self.imagView = [[UIImageView alloc] init];
        self.imagView.layer.cornerRadius = 5;
        _imagView.clipsToBounds = YES;
        [self.contentView addSubview:_imagView];
        
        /** 标题 **/
        self.titleLabel = [[UILabel alloc] init];
        _titleLabel.font = [UIFont systemFontOfSize:18];
        [self.contentView addSubview:_titleLabel];
        /** 描述 **/
        
        self.descriptionLabel = [[UILabel alloc] init];
        _descriptionLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:_descriptionLabel];
        
        
        /** 时长图片 **/
        self.timeView = [[UIImageView alloc] init];
        [_timeView setImage:[UIImage imageNamed:@"shijian"]];
        [self.contentView addSubview:_timeView];
        
        /** 时长 **/
        self.timeLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_timeLabel];
        
        /** 点击量 **/
        self.playCountLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_playCountLabel];
        
        /** 播放图片 **/
        self.playView = [[UIImageView alloc] init];
        //        self.playView.backgroundColor = [UIColor cyanColor];
//        [_playView setImage:[UIImage imageNamed:@"bf"]];
        
        [self.contentView addSubview:_playView];
        
        /** 评论 **/
        self.pinglunButton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.pinglunButton.backgroundColor = [UIColor redColor];
        //        [_pinglunButton setImage:[UIImage imageNamed:@"pinglun1.png"] forState:UIControlStateNormal];
        [self.contentView addSubview:_pinglunButton];
        
        /** 播放按钮 **/
        self.playButton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.playButton.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_playButton];
        //        NSLog(@"%@", self.str);
        
        //
        
        
        
        [self.imagView NightWithType:UIViewColorTypeNormal];
        [self.titleLabel NightWithType:UIViewColorTypeNormal];
        [self.descriptionLabel NightWithType:UIViewColorTypeNormal];
        [self.timeView NightWithType:UIViewColorTypeNormal];
        [self.timeLabel NightWithType:UIViewColorTypeNormal];
        [self.playCountLabel NightWithType:UIViewColorTypeNormal];
        [self.pinglunButton NightWithType:UIViewColorTypeNormal];

//        [self.playView NightWithType:UIViewColorTypeNormal];
        
        
    }
    //
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    
   self.imagView.frame = CGRectMake(15 * KWITH , 80 * KHIGHT , self.contentView.frame.size.width - 30, 200 * KHIGHT );
    
//    [_imagView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(@10);
//        make.top.equalTo(@10);
//        make.right.equalTo(@150);
//        make.bottom.equalTo(@10);
//    }];
    
    // layer需要设置大小
    
    self.titleLabel.frame       = CGRectMake(15 * KWITH, 17 *KHIGHT, self.contentView.frame.size.width - 20, 40 * KHIGHT);
    self.descriptionLabel.frame = CGRectMake(10 * KWITH, 50 * KHIGHT, self.contentView.frame.size.width - 20, 30 *  KHIGHT);

    self.timeView.frame         = CGRectMake(20 * KWITH, 285 * KHIGHT, 20 * KWITH, 20 * KHIGHT);
    self.timeLabel.frame        = CGRectMake(40 * KWITH, 280 * KHIGHT, 150 * KWITH, 30 * KHIGHT);

    self.playView.frame         = CGRectMake(100 * KWITH, 284 * KHIGHT, 22 * KWITH, 22 * KHIGHT);
    self.playCountLabel.frame   = CGRectMake(200 * KWITH, 280 * KHIGHT, 150 * KWITH , 30 * KHIGHT);
}







- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
